package com.campus.controller;

import com.campus.model.Course;
import com.campus.service.CourseService;
import com.campus.web.vo.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.campus.common.BusinessConstants.API_BASE;

@Slf4j
@RestController
@RequestMapping("/courses")
public class CourseController {

    @Autowired
    private CourseService courseService;

    @PostMapping("/create")
    public ResponseResult<Course> createCourse(@RequestBody Course course) throws Exception {
        Course course1 = courseService.createCourse(course);
        return ResponseResult.ok(course1, "Course created successfullyA");
    }
}
